<?php /* Smarty version 2.6.20, created on 2011-10-25 17:38:12
         compiled from _core/_include/module/_mvc/control/handlecontainersampleattribute.tpl */ ?>
function HandleContainerSampleAttribute(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : null;
  this._parent = (options && options.parent) ? options.parent : null;
  this._index = (options && options.index) ? options.index : null;
  
  this._createElements();
}

HandleContainerSampleAttribute.prototype._createElements = function() {
  var _self = this;
  
  gui.name.onchange = function() { _self._item.name = this.value; }
  gui.remove.onclick = function() { _self._parent.attributes.splice(_self._index, 1);
                                    _self._callbackFunc();
                                    return false;
                                  };


  gui.addOption._item = this._item;
  
  gui.addOption.onclick = function() { _self._item.options[_self._item.options.length] = v1sampleattributeoption.instance();
                                       _self._callbackFunc();
                                       return false;
                                     };
  for (var i = 0, il = this._item.options.length; i < il; i++) {
    var option = this._item.options[i];
    var guiOption = this._gui.options[i];
    
    guiOption.name._option = option;
    guiOption.name.onchange = function() { this._option.name = this.value; };
    
    guiOption.remove._index = i;
    guiOption.remove.onclick = function() { _self._item.options.splice(this._index, 1);
                                            _self._callbackFunc();
                                            return false;
                                          };
  }
};